package com.atguigu.day17.homework.h1;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Random;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/20 21:00
 * @注释
 */
public class VerificationCode {
    @Test
    public void test(){
        ArrayList<Character> letterList = new ArrayList<>();
        for (int i = 0; i < 26; i++) {
            letterList.add((char) ('a' + i));
        }
        for (int i = 0; i < 26; i++) {
            letterList.add((char) ('A' + i));
        }
        for (int i = 0; i < 10; i++) {
            letterList.add((char) (48 + i));
        }

        Random r = new Random();
        for (int i = 0; i < 10; i++) {
            String s = "";
            for (int j = 0; j < 6; j++) {
                s += letterList.get(r.nextInt(letterList.size()));

                //String.valueOf(r.nextInt(letterList.size()));
                //str.add(r.nextInt(letterList.size()));
            }
            System.out.println("验证码: " + s);
        }

    }
}
